package com.team.polyvore;

import android.os.Bundle;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;

public class LoadingActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_loading);
        Thread welcomeThread = new Thread(new WelcomeThread(this));
		welcomeThread.start();
    }

    private class WelcomeThread implements Runnable{
		private Context context;
		private int welcomeScreenDisplay = 3000;
		private int wait = 0;
		
		
		public WelcomeThread(Context context) {
			this.context = context;
		}
		@Override
		public void run() {
			try {
				
				
				//delete .apk file
				
				while (wait < welcomeScreenDisplay) {
					Thread.sleep(1000);
					wait += 1000;
				}
//				while(isWait){
//					Thread.sleep(1000);
//				}
				
			} catch (Exception e) {
				System.out.println("EXc=" + e);
			} finally {
				/**
				 * Called after splash times up. Do some action after splash
				 * times up. Here we moved to another main activity class
				 */
				
				startActivity(new Intent(LoadingActivity.this,MainActivity.class));
				
				finish();
			}
		}
	}

}
